package com.papercutting.platform.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.papercutting.platform.dto.query.NewsQuery;
import com.papercutting.platform.entity.News;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 活动资讯Mapper接口
 */
@Mapper
public interface NewsMapper extends BaseMapper<News> {
    
    IPage<News> selectNewsPage(Page<News> page, @Param("query") NewsQuery query);
    
    List<News> selectNewsList(@Param("query") NewsQuery query);
    
    List<News> selectRecommendedNews(@Param("limit") Integer limit);
    
    List<News> selectTopNews();
    
    List<News> selectByType(@Param("type") Integer type, @Param("limit") Integer limit);
    
    int increaseViewCount(@Param("id") Long id);
    
    int increaseLikeCount(@Param("id") Long id);
    
    int decreaseLikeCount(@Param("id") Long id);
    
    int increaseShareCount(@Param("id") Long id);
    
    int batchUpdateStatus(@Param("ids") List<Long> ids, @Param("status") Integer status);
}